<?php
require_once('common/common.php');
$sql='
	select
	officeschema.clientes.CliNombre as emissorNome,
	officeschema.beneficiarios.BnfNombre as receptorNome,
	site.transferencia.*
	from site.transferencia
	join officeschema.clientes on site.transferencia.emissor=officeschema.clientes.CliNumero
	join officeschema.beneficiarios on site.transferencia.receptor=officeschema.beneficiarios.BnfNumero
	;';
$transferencias=$DbSite->getall($sql);
foreach($transferencias as &$value)
{
	$sql='select officeschema.origenes.OriOrden as id, officeschema.origenes.OriNombre as nome
				from officeschema.origenes
				where officeschema.origenes.OriDominio=126
				and officeschema.origenes.OriOrden='.$value->modoDeCobranca;
	$result=$DbTuga->getall($sql);
	$result=$result[0]->nome;
	$value->modoDeCobranca=$result;
	
	$sql='select mp_ModoPago as nome from officeschema.hd_modospago where mp_id='.$value->modoDePagamento;
	$result=$DbTuga->getall($sql);
	$result=$result[0]->nome;
	$value->modoDePagamento=$result;
	
	//moedas
	$sql='select miso_id as id from officeschema.hd_monedasiso where officeschema.hd_monedasiso.miso_Cod_elite='.$value->moedaEmissor;
	$result=$DbTuga->getall($sql);
	$result=$result[0]->id;
	$value->moedaEmissorExtenso=$result;
	
	$sql='select miso_id as id from officeschema.hd_monedasiso where officeschema.hd_monedasiso.miso_Cod_elite='.$value->moedaReceptor;
	$result=$DbTuga->getall($sql);
	$result=$result[0]->id;
	$value->moedaReceptorExtenso=$result;
}
$smarty->assign('transferencias',$transferencias);
$smarty->assign('menu','gestaoDeTransferencias');
$smarty->display('index.tpl');